package com.quanyan.place.constants;

import com.quanyan.redisCluster.utils.RedisConstants;
import com.quanyan.redisCluster.utils.RedisKey;

/**
 * Created by dongsheng.lin on 2017/4/28.
 *
 * 场馆缓存redisKey定义
 */
public class PlaceRedisConstans {

    /******************************************原系统用到却没有实现的***************************************************/

    /**
     * 场馆缓存前缀
     */
    private static final String placeFamilyKey = RedisConstants.PLACE_FAMILY_KEY;

    /**
     * 用户收藏的场馆列表
     * @param uid 用户id
     * @return
     */
    public static RedisKey getPlaceCollectListKey(int uid){
        return new RedisKey(placeFamilyKey,"USER_PLACES_COLLECTLIST:" + "UID_" + uid);
    }

    /**
     *  手机验证码
     * @param phone 目标手机号码
     * @param templateId  模板id
     * @param resend 重发时间
     * @return
     */
    public static RedisKey getPhoneMessageSendKey(String phone, Byte templateId, int resend){
        return new RedisKey(placeFamilyKey,"USER_PHONE_MESSAGE_RESEND:" + "TEMPLATE_ID_" + templateId + "_PHONE_" + phone + "_" + resend);
    }

    /**
     * 管理用户
     * @param adminId 管理员id
     * @return
     */
    public static RedisKey getAdminUserKey(int adminId){
        return new RedisKey(placeFamilyKey,"PLACE_ADMIN:"+"ADMIN_ID_" + adminId);
    }

    /**
     *  场馆信息（存放从数据库拿出来的表信息）
     * @param placeId 场馆id
     * @return
     */
    public static RedisKey getPlaceInfoKey(int placeId){
        return new RedisKey(placeFamilyKey,"PLACE_INFO:" + "PLACE_ID_" + placeId);
    }

    /**
     *  场馆附属信息（存放从数据库拿出来的表信息）
     * @param placeId 场馆id
     * @return
     */
    public static RedisKey getPlaceAttachKey(int placeId){
        return new RedisKey(placeFamilyKey,"PLACE_ATTACH_INFO:" + "PLACE_ID_" + placeId);
    }

    /**
     *  场馆基本信息
     * @param placeId 场馆id
     * @return
     */
    public static RedisKey getPlaceBaseInfoKey(int placeId){
        return new RedisKey(placeFamilyKey,"PLACE_BASE_INFO:" + "PLACE_ID_" + placeId);
    }

    /**
     * 用户分享前缀
     * @param uid 用户id
     * @return
     */
    public static RedisKey getUserSharePrefixKey(int uid){
        return new  RedisKey(placeFamilyKey,"USER_SHARE_PREFIX:" + uid);
    }

    /**
     *  场馆二维码
     * @param qrCode 二维码Json串
     * @return
     */
    public static RedisKey getQRCodeKey(String qrCode){
        return new RedisKey(placeFamilyKey,"PLACE_QRCODE:" + qrCode);
    }

    /**
     * 用户Token
     * @param uid 用户id
     * @return
     */
    public static RedisKey getTokenKey(int uid){
        return new RedisKey(placeFamilyKey,"USER_TOKEN:" + uid);
    }

    /**
     * 场馆运动类目
     * @return
     */
    public static RedisKey getPlaceCategoryKey(){
        return new RedisKey(placeFamilyKey,"PLACE_CATEGORY:");
    }

    /**
     * 场馆活动状态
     * @param placeId 场馆id
     * @return
     */
    public static RedisKey getPlaceActivityStatusKey(int placeId){
        return new RedisKey(placeFamilyKey,"PLACE_ACTIVITY_STATUS:" + placeId);
    }

    /**
     * 条形码状态
     * @param posBarCode 条形码
     * @return
     */
    public static RedisKey getPosBarCodeStatusKey(String posBarCode){
        return new RedisKey(placeFamilyKey,"IS_SCAN_ORDER_NO:" + posBarCode);
    }


    /********************************************原系统用到并且已经实现了的*****************************************/
    /**
     * 获取系统参数配置
     * @return
     */
    public static RedisKey getAllCommonParameterKey(){
        return new RedisKey(placeFamilyKey,"PLACE_COMMON_PARMETER:");
    }

    /**
     * 系统运动类目
     * @return
     */
    public static RedisKey getSysCategroyInfoKey(){
        return new RedisKey(placeFamilyKey,"PLACE_ALL_CATEGORIES:");
    }

    /**
     * 获取省份列表
     * @return
     */
    public static RedisKey getProvincesKey(){
        return new RedisKey(placeFamilyKey,"PLACE_PROVINCES:");
    }

    /**
     * 获取城市列表
     * @return
     */
    public static RedisKey getCitiesKey(){
        return new RedisKey(placeFamilyKey,"PLACE_CITIES:");
    }

    /**
     * 获取城市信息
     * @return
     */
    public static RedisKey getCitiesInfoKey(){
        return new RedisKey(placeFamilyKey,"PLACE_CITIES_INFO:");
    }

    /**
     * 获取地区列表
     * @return
     */
    public static RedisKey getDistrictsKey(){
        return new RedisKey(placeFamilyKey,"PLACE_DISTRICTS:");
    }

    /**
     * 通过城市id获取区域列表
     * @param cityId
     * @return
     */
    public static RedisKey getDistrictsByCityIdKey(int cityId){
        return new RedisKey(placeFamilyKey,"PLACE_CITYID_" + cityId + "_DISTRICTS");
    }

    /**
     * 通过 tag_group 获取字典
     * @param tagGroup
     * @return
     */
    public static RedisKey getDictsByTagGroupKey(String tagGroup){
        return new RedisKey(placeFamilyKey,"PLACE_DICTS_TAG_GROUP_:" + tagGroup);
    }

    /**
     * 获取自定义城市区域
     * @return
     */
    public static RedisKey getCityRegionKey(){
        return new RedisKey(placeFamilyKey,"PLACE_CITY_REGIONS");
    }
}
